import 'package:flutter/material.dart';
import 'package:flutter_frame/app/modules/home/canvas/canvas_rabbit/canvas_rabbit_controller.dart';
import 'package:flutter_frame/app/modules/home/canvas/canvas_rabbit/rabbit_painter.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

//图像绘制
class CanvasRabbitWidget extends StatelessWidget {
  CanvasRabbitWidget({Key? key}) : super(key: key);

  final controller = Get.put(CanvasRabbitController());

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('图像绘制'),
      ),
      body: Container(
        color: const Color(0xffFFE3AF),
        child: Center(
          child: AnimatedBuilder(
            animation: controller.animationController,
            builder: (context, child) {
              return CustomPaint(
                painter: RabbitPainter(
                  bodyAnimation: controller.animationController,
                ),
                size: Size(0.8.sw, 1.sw),
              );
            },
          ),
        ),
      ),
    );
  }
}
